<!--  -->
<template>
  <div class="login">
    <div class="main">
      <img class="main-bg" src="../../assets/img/bj.png" alt="">
      <div class="main-login">
        <div class="main-title">账号登录</div>
        <div class="login-form">
          <input type="text" v-model="accountNumber" class="login-input" placeholder="账号">
          <input type="password" v-model="password" class="login-input" placeholder="密码">
          <!-- <input type="text" class="login-input" placeholder="验证码"> -->
          <button class="login-btn" @click="toLogin">登录</button>
        </div>
      </div>
      <img class="bottom-bg" src="../../assets/img/logo.png" alt="">
    </div>
  </div>
</template>

<script>
export default {
  data () {
    return {
      accountNumber: '',
      password: '',
      form: {
        name: '',
      }
    }
  },

  components: {},

  computed: {},

  methods: {
    async toLogin () {
      const params = {
        accountNumber: this.accountNumber,
        password: this.password
      }
      console.log(params)
      const result = await this.API.reqUserLogin(params)
      console.log(result)
      if (result.retCode !== '000') {
        this.$Message.error('登录失败')
        return false
      }
      this.$Message.success('登录成功')
      sessionStorage.setItem('token', result.retData.token)
      sessionStorage.setItem('userId', result.retData.managerInfo.id)
      sessionStorage.setItem('userInfo', JSON.stringify(result.retData.managerInfo))
      this.$router.replace('/adpicture')
    }
  }
}

</script>
<style lang='stylus' scoped>
.login
  position relative
  .main-bg
    position absolute
    top 0
    left 0
  .main-login
    width 425px
    height 500px
    padding 0 30px
    background #fff
    position absolute
    top 160px
    right 400px
    border 3px
    .main-title
      font-size 18px
      font-weight bold
      height 100px
      line-height 100px
      margin-botton 10px
    .login-form
      .login-input
        outline none
        width 365px
        height 50px
        padding 0 20px
        margin-bottom 30px
        border 1px solid #DDDDDD
        background-color #F5F5F5
        border-radius 3px
      .login-btn
        width 365px
        height 50px
        background #145B3E
        outline none
        border none
        border-radius 3px
        color #fff
        margin-top 20px
  .bottom-bg
    position absolute
    bottom 40px
    width 328px
    height 46px
    left 50%
    margin-left -164px
    z-index 1000
</style>